{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">用户管理</li>
            <!--<li class=""><a href="{:url('admin/user/add')}">添加用户</a></li>-->
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

                <form class="layui-form layui-form-pane" action="{:url('admin/user/index')}" method="get">
                    <div class="layui-elem-quote  title-select">
                    <div class="layui-inline">
                        <label class="layui-form-label">关键词</label>
                        <div class="layui-input-inline">
                            <input type="text" name="keyword" value="{$keyword}" placeholder="请输入关键词" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">用户性别：</label>
                        <div class="layui-input-inline">
                            <select name="sex_select" class="mng" lay-filter="ct">
                                {if empty($sex_select) }<option value="" selected>请选择</option>{/if}
                                {foreach $sex_arr as $k=>$v}
                                <option value="{$k}"  {if $sex_select == $k  } selected {/if}>{$v}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">范围选择</label>
                            <div class="layui-input-inline">
                                <input class="layui-input" placeholder="开始日" id="LAY_demorange_s" name="start_time" value="{$start_time}">
                            </div>
                            <div class="layui-input-inline">
                                <input class="layui-input" placeholder="截止日" id="LAY_demorange_e" name="end_time" value="{$end_time}">
                            </div>
                        </div>
                    <div class="layui-inline">
                        <button class="layui-btn">搜索</button>
                    </div>
                    </div>
                </form>
                <div class="layui-inline">
                    搜索用户数:{$all_user_num}

                </div>
                <hr>
                <form action="" method="post" class="ajax-form">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 15px;"><input type="checkbox" class="check-all"></th>
                        <th style="width: 30px;">ID</th>
                        <th>用户昵称</th>
                        <th>手机号码</th>
                        <th>用户性别</th>
                        <th>用户拍币</th>
                        <th>用户余额</th>
                        <th>注册时间</th>
                        <th>启用状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="user_list" item="vo"}
                    <tr>
                        <td><input type="checkbox" name="ids[]" value="{$vo.id}"></td>
                        <td>{$vo.id}</td>
                        <td>{$vo.username}</td>
                        <td>{$vo.mobile}</td>
                        <th>{$vo.sex_name}</th>
                        <th>{$vo.coin}</th>
                        <th>{$vo.balance}</th>
                        <td>{$vo.create_time}</td>
                        <td class="layui-form">
                            <input type="checkbox" name="status" value="{$vo.id}" lay-skin="switch"
                                   lay-text="ON|OFF" lay-filter="changeUserStatus"
                                   {if $vo.status == 1}
                                   checked
                                   {/if}
                            >
                        </td>
                        <td>
                            <a href="{:url('admin/user/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                            <a href="{:url('admin/user/userinfo',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">查看</a>
                            <a href="{:url('admin/user/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                    <button type="button" class="layui-btn layui-btn-danger layui-btn-small ajax-action" data-action="{:url('admin/newsflash/batch_delete')}">删除选中</button>
                </form>
                <!--分页-->
                {$user_list->render()}
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}

<script type="text/javascript">

    //监听指定开关
    form.on('switch(changeUserStatus)', function (data) {
        changeUserStatus(data);
    });
</script>
{/block}